package com.test.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.test.manager.LoginManager;
import com.test.model.User;

public class LoginManagerImpl extends HibernateDaoSupport implements
		LoginManager {
	@SuppressWarnings("unchecked")
	public boolean isLogin(String username, String password) {

		/*
		 * if (null != username && null != password &&
		 * "intrl".equals(username.trim()) && "intrl".equals(password.trim())) {
		 * return true; } return false;
		 */
 
		Object[] s = new Object[2];
		s[0] = username;
		s[1] = password;
		List<User> users = this.getHibernateTemplate().find(
				"from User user where user.username=? and password=?", s);
		if (users.size() == 0) {
			return false;
		}
		return true;
	}
}
